package com.hk.controller;


import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

import org.springframework.validation.BindException;
import org.springframework.web.servlet.ModelAndView;
import org.springframework.web.servlet.mvc.SimpleFormController;

import com.hk.dtos.BoardDTO;
import com.hk.service.BoardService;

public class BoardInsertFrmController extends SimpleFormController{

	private BoardService boardService;
	
	public void setBoardService(BoardService boardService) {
		this.boardService = boardService;
	}

	@Override
	protected ModelAndView onSubmit(HttpServletRequest request,
			HttpServletResponse response, Object command, BindException errors)
			throws Exception {
		// TODO Auto-generated method stub
		BoardDTO dto=(BoardDTO)command;
		
		boardService.insertBoard(dto);
		
		return new ModelAndView("redirect:/boardList.cs");
	}
	
	
}
